package cn.swu.lzr;
import java.awt.*;
import java.io.*;
import java.net.URL;


public class Pagereader{
    public  void Pagereader() {
        //创建url对象
        try {
            URL url = new URL("http://10.122.7.154/javaweb/data/images-url.txt");

            //创建txt文件临时储存从网上读取问文本文件
            File file1 = new File("test.txt");
            //创建输入流和输出流
            InputStream is = url.openStream();
            OutputStream os = new FileOutputStream(file1);

            byte[] buffer = new byte[1024];

            int len;

            while((len = is.read(buffer)) != -1){
                os.write(buffer,0,len);
            }

            is.close();
            os.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }








    }
}